
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 1
 * @Author : WangRuoyu 
 * @Date : 2023/5/18 21:05
 */

#include "iostream"

using namespace std;

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    int a[n];
    int c[n];
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        if (i == 0) {
            c[i] = 1;
        } else {
            c[i] = c[i - 1] * a[i - 1];
        }
    }

    for (int i = 1; i < n; ++i) {
        printf("%d ", (m % c[i]) / c[i - 1]);
        m -= m % c[i];
    }
    printf("%d", m / c[n - 1]);

    return 0;
}